package org.yzh.protocol.commons.transform.attribute;

import io.github.yezhihao.protostar.annotation.Field;

import java.util.ArrayList;
import java.util.List;

public class WifiData {

    public static final Integer key = 84;

//    @Field(length = 1, desc = "wifi个数")
    private int count;

    @Field(totalUnit = 1, desc = "wifi基本信息")
    private List<WifiBasic> items;

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public List<WifiBasic> getItems() {
        return items;
    }

    public void setItems(List<WifiBasic> items) {
        this.items = items;
        this.count = items == null ? 0 : items.size();
    }

    public void addItem(String mac, int signal) {
        if (items == null){
            items = new ArrayList<>(2);
        }
        items.add(new WifiBasic(mac, signal));
    }

    @Override
    public String toString() {
        return "WifiData{" +
                "count=" + count +
                ", items=" + items +
                '}';
    }
}
